<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>03_jsonArrayObject</title>
</head>
<body>
<script type="text/javascript">
  /*
    json数组的元素是对象
    数组定义2个元素，每个元素是对象
    对象是键值对
   */
  let jsonArrary = [
    {"name":"张三", "age": 20},
    {"name":"李四", "age": 22}
  ]
  // 获取需要的数据，李四 22
  console.log(jsonArrary[1].name, jsonArrary[1].age)
  // 遍历数组，取出数组中的元素
  for (let i = 0; i < jsonArrary.length; i++) {
    console.log(jsonArrary[i].name, jsonArrary[i].age)
  }
</script>
</body>
</html>